// mircoApp/trainingCourse/manage/index/index.js
const skinBehavior = require('../../../../utils/themeSkin/skinBehavior');
import util from '../../../../utils/util';
const app = getApp();
Page({
  behaviors: [skinBehavior],

  /**
   * 页面的初始数据
   */
  data: {
    imgPath: app.globalData.imgPath,
    active: '0',
    recordInd: '',
    theme_color: "#fff",
    searchVal: '',
    listData: [],
    // 审核记录弹窗
    recordShow: false,
    checkboxArr: [],
    // 代客报名弹窗
    courseShow: false,
    course_list: [], //课期列表，代客报名用
    applyJson: {
      goods_id: '',
      course_type: '',
      member_id: '',
      id: ''
    },
    changeJson: {
      id: '',
      member_id: '',
      course_term_id: '',
    },
    inpDonate: '',
    donateJson: {
      goods_id: '',
      course_type: 0,
      count: 1,
      receive_member_id: '',
      member_id: '',
    },
    // 核销弹窗
    donateShow: false,
    // 代客转赠查询课程类型
    donateCourseType_show: false,
    donateCourseType_list: [],
    // 核销统计日期
    SelectTime: '',
    statisticsCount: 0,
    currentDate: new Date().getTime(),
    maxDate: new Date().getTime(),
    formatter(type, value) {
      if (type === 'year') {
        return `${value}年`;
      }
      if (type === 'month') {
        return `${value}月`;
      }
      if (type === 'day') {
        return `${value}日`
      }
      return value;
    },
    statisticsHide: true,

    page: 1,
    total_page: 0,
    isLoadMore: true,
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad(options) {

  },
  init() {
    this.setData({
      page: 1,
      total_page: 0,
      isLoadMore: true,
      listData: [],
      searchVal: '',
      recordInd: ''
    })
  },

  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady() {

  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow() {
    this.init();
    this.getData();
  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide() {

  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload() {

  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh() {

  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom() {
    if (this.data.isLoadMore) {
      wx.showLoading({
        title: '加载更多',
      })
      this.getMoreData();
    } else {
      console.log('没有更多了');
    }
  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage() {

  },
  unfold(e) {
    let {
      index,
      item
    } = e.currentTarget.dataset;
    this.data.listData[index].TabShow = true;
    this.setData({
      ["listData[" + index + "].TabShow"]: true
    })
  },
  chiltabsChange(e) {
    let {
      index,
      item
    } = e.currentTarget.dataset;
    this.setData({
      ["listData[" + index + "].TabShow"]: false,
      ["listData[" + index + "].tabInd"]: e.detail.index,
      checkboxArr: []
    })
  },
  againTap(e) {
    console.log(e)
    let {
      id
    } = e.currentTarget.dataset;
    wx.navigateTo({
      url: `/mircoApp/cultivateCourse/manage/recording/recording?id=${id}`,
    })
  },
  toRecord() {
    wx.navigateTo({
      url: '/mircoApp/cultivateCourse/manage/recording/recording',
    })
  },
  recordShowTap(e) {
    let {
      item
    } = e.currentTarget.dataset;
    this.setData({
      recordShow: true,
      recordInfo: item
    })
  },
  closePopup() {
    this.setData({
      recordShow: false,
      recordInfo: []
    })
  },
  // 录单导航
  tapRecord(e) {
    let {
      ind
    } = e.currentTarget.dataset;
    if (this.data.recordInd != ind) {
      this.setData({
        recordInd: ind,
        page: 1
      })
      this.getCateData();
    }

  },
  // 切换导航
  changeTab(e) {
    let {
      index
    } = e.detail;
    this.setData({
      active: index,
    })
    this.init();
    this.getCateData();
  },
  searchBtn() {
    this.setData({
      page: 1,
      total_page: 0,
      isLoadMore: true,
      listData: [],
      recordInd: '',
      checkboxArr: []
    })
    this.getCateData();
  },
  getCateData() {
    let json = {};
    let api_url = "";
    if (this.data.activeId == 3) {
      // 录单
      json.status = this.data.recordInd;
      json.page = this.data.page;
      api_url = "plugin.cultivate-course.frontend.controllers.course.live-order.get-live-order-list";
    } else if (this.data.activeId == 1) {
      // 查询
      json.keyword = this.data.searchVal;
      json.page = this.data.page;
      api_url = "plugin.cultivate-course.frontend.controllers.course.course";
    } else {
      api_url = "plugin.cultivate-course.frontend.controllers.course.clerk";
      json.date = (this.data.SelectTime / 1000);
    }
    let urlStr = app.getNetAddresss(api_url);
    app._postNetWork({
      url: urlStr,
      data: json,
      success: (resdata) => {
        var res = resdata.data;
        if (res.result == 1) {
          this.data.isLoadMore = true;
          this.data.total_page = res.data.last_page;
          if (!this.data.total_page) {
            this.data.total_page = 0;
          }
          this.setData({
            listData: res.data.data
          })
        } else {
          app.tips(res.msg)
        }
      },
      fail: function (res) {
        console.log(res);
      },
    });
  },
  getMoreData() {
    let urlStr = "";
    this.data.isLoadMore = false; // 防止多次请求分页数据
    console.log(this.data.page, this.data.total_page)
    if (this.data.page >= this.data.total_page) {
      wx.hideLoading()
      return;
    } else {
      this.setData({
        page: this.data.page + 1
      })
      let json = {};
      let api_url = "";
      if (this.data.activeId == 3) {
        // 录单
        json.status = this.data.recordInd;
        json.page = this.data.page;
        api_url = "plugin.cultivate-course.frontend.controllers.course.live-order.get-live-order-list";
      } else if (this.data.activeId == 1) {
        // 查询
        json.keyword = this.data.searchVal;
        json.page = this.data.page;
        api_url = "plugin.cultivate-course.frontend.controllers.course.course";
      } else {
        json.page = this.data.page;
        json.date = (this.data.SelectTime / 1000);
        api_url = "plugin.cultivate-course.frontend.controllers.course.clerk";
      }
      urlStr = app.getNetAddresss(api_url);
      app._postNetWork({
        url: urlStr,
        data: json,
        success: (resdata) => {
          let res = resdata.data
          if (res.result == 1) {
            this.data.isLoadMore = true;
            this.setData({
              listData: this.data.listData.concat(res.data.data)
            })
            wx.hideLoading();
          } else {
            this.data.page = this.data.page - 1;
            this.isLoadMore = false;
            wx.hideLoading();
            wx.showToast({
              icon: 'none',
              title: res.msg,
              duration: 1500
            });
          }
        },
        fail: function (res) {
          console.log(res);
        }
      });
    }
  },
  getData() {
    let basic_info = wx.getStorageSync('yz_basic_info');
    if (this.options.id) {
      this.setData({
        activeId: this.options.id
      })
      this.getCateData();
    } else {
      wx.navigateBack({
        delta: 1
      })
    }
    if (this.options.id == 1) {
      wx.setNavigationBarTitle({
        title: basic_info.plugin_setting.cultivate_course.cultivate_query_name,
      })
    } else if (this.options.id == 3) {
      wx.setNavigationBarTitle({
        title: basic_info.plugin_setting.cultivate_course.cultivate_live_name,
      })
    } else {
      wx.setNavigationBarTitle({
        title: basic_info.plugin_setting.cultivate_course.cultivate_clerk_name,
      })
      // 请求核销统计
      this.getStatistics();
    }
  },
  // 课程/课期 加载更多
  moreBtnChild(e) {
    let {
      item,
      index
    } = e.currentTarget.dataset;
    let listInfo = [];
    let json = {
      is_goods: 1,
      member_id: item.uid
    }
    if (item.tabInd == 1) {
      listInfo = item.course_term_list;
      json.is_goods = 0;
    } else {
      listInfo = item.goods_list;
    }
    // if (listInfo.currentTarget >= listInfo.last_page) {
    //   app.tips('没有更多了')
    //   return
    // }
    json.page = listInfo.current_page + 1
    let urlStr = app.getNetAddresss("plugin.cultivate-course.frontend.controllers.course.course.get-goods-or-course-list");
    app._postNetWork({
      url: urlStr,
      data: json,
      success: (resdata) => {
        var res = resdata.data;
        if (res.result == 1) {
          console.log(res.data)
          if (item.tabInd == 1) {
            this.setData({
              ['listData[' + index + '].course_term_list.current_page']: res.data.current_page,
              ['listData[' + index + '].course_term_list.data']: this.data.listData[index].course_term_list.data.concat(res.data.data)
            })
          } else {
            this.setData({
              ['listData[' + index + '].goods_list.current_page']: res.data.current_page,
              ['listData[' + index + '].goods_list.data']: this.data.listData[index].goods_list.data.concat(res.data.data)
            })
          }
        } else {
          app.tips(res.msg)
        }
      },
      fail: function (res) {
        console.log(res);
      },
    });
  },
  // 业务按钮
  transfer(e) {
    let {
      key,
      item
    } = e.currentTarget.dataset;
    if (this.data.checkboxArr.length <= 0) {
      if (item.tabInd == 1) {
        app.tips('请先勾选课期')
      } else {
        app.tips('请先勾选课程')
      }
      return
    }
    switch (key) {
      case 'applyTap':
        this.setData({
          'applyJson.member_id': item.uid
        })
        this.applyTap();
        break;
      case 'donate':
        console.log('代客转赠', item)
        // 先去获取当前勾选的课程类型
        this.setData({
          // donateShow: true,
          'donateJson.goods_id': this.data.checkboxArr[0],
          'donateJson.member_id': item.uid
        })
        this.getDonateCourse_type();
        break;
      case "verification":
        // console.log('核销报名', item, this.data.checkboxArr[0])
        let course_term_list = item.course_term_list.data
        course_term_list.forEach((ele, index) => {
          if (ele.id == this.data.checkboxArr[0]) {
            wx.showModal({
              title: "提示",
              content: `确认核销[${ele.title}]?`,
              complete: (res) => {
                if (res.confirm) {
                  this.clerkPost(item.uid);
                }
              }
            })
          }
        });
        break;
      case "changing":
        console.log('改签课期', item)
        // 用户要改签的课期id
        this.data.changeJson.member_id = item.uid;
        // 用户报名中课期id
        this.data.changeJson.id = this.data.checkboxArr[0];
        this.setData({
          changeJson: this.data.changeJson
        })
        this.getCourseList('changing');
        break;
      default:
        console.log('没有对应的')
        break;
    }
    console.log(key)
  },
  // 代客报名
  async applyTap() {
    await this.getCourseList('apply');
  },
  selectChanging(e) {
    let id = e.currentTarget.dataset.item.id;
    this.setData({
      'applyJson.id': id,
      'applyJson.goods_id': this.data.checkboxArr[0]
    })
  },
  select_Changing(e) {
    let id = e.currentTarget.dataset.item.id;
    if (id == this.data.changeJson.id) {
      app.tips('该课期与更改之前一样无法改签')
      return
    }
    this.setData({
      'changeJson.course_term_id': id,
    })
    console.log(this.data.changeJson.course_term_id);
  },
  onClose() {
    this.data.applyJson = {
      goods_id: '',
      course_type: '',
      member_id: '',
      id: ''
    }
    this.setData({
      courseShow: false,
      applyJson: this.data.applyJson,
      replaceShow: false,
    })
  },
  // 更换课程弹窗点击事件
  async tapRadio(e) {
    let {
      id,
      item
    } = e.currentTarget.dataset;
    this.data.quota.quota = item;
    this.setData({
      quota: this.data.quota
    })
  },
  // 代客报名 请求
  cinfirmApply() {
    this.data.applyJson.course_type = this.data.quota.quota.course_type;
    let urlStr = app.getNetAddresss("plugin.cultivate-course.frontend.controllers.course.replace.enroll");
    app._postNetWork({
      url: urlStr,
      data: this.data.applyJson,
      success: (resdata) => {
        var res = resdata.data;
        if (res.result == 1) {
          app.tips(res.msg);
          this.data.applyJson = {
            goods_id: '',
            course_type: '',
            member_id: '',
            id: ''
          }
          this.setData({
            courseShow:false,
            replaceShow:false,
            dialogShow:false,
            applyJson: this.data.applyJson,
          })
          this.getCateData();
        } else {
          app.tips(res.msg);
        }
      },
      fail: function (res) {
        console.log(res);
      },
    });
  },
  // dialog 弹窗关闭
  onClose_dialog() {
    this.setData({
      dialogShow: false,
      replaceShow: false,
      quota: [],
      quota_list: [],
    })
  },
  // 更换课期
  tapReplaceShow() {
    this.setData({
      replaceShow: true,
      dialogShow: false
    })
  },
  // 关闭更换课程
  onClose_replaceShow() {
    this.setData({
      replaceShow: false,
      dialogShow: true
    })
  },
  async applyTapComfirm() {
    await this.getQuota();
  },
  getQuota(key = '') {
    let json = {
      id: this.data.applyJson.id,
      page: this.data.page,
      member_id: this.data.applyJson.member_id
    }
    if (key == 'more') {
      if (this.data.total_page >= this.data.page) {
        return
      }
      this.setData({
        page: this.data.page + 1
      })
    }
    app._postNetWork({
      url: app.getNetAddresss("plugin.cultivate-course.frontend.controllers.term.detail.get-quota-list"),
      data: json,
      success: (resdata) => {
        var res = resdata.data;
        if (res.result == 1) {
          if (key == 'more') {
            this.setData({
              quota_list: this.data.quota_list.concat(res.data.quota_list)
            })
            return
          }
          this.data.isLoadMore = true;
          this.data.total_page = res.data.quota_list.last_page;
          if (!this.data.total_page) {
            this.data.total_page = 0;
          }
          this.setData({
            dialogShow: true,
            quota: res.data,
            quota_list: res.data.quota_list,
            total_page: this.data.total_page
          })
        } else {
          if (key == 'more') {
            this.data.page = this.data.page - 1;
            this.data.isLoadMore = false
            return
          }
          app.tips(res.msg);
          // wx.showToast({
          //   title: res.msg,
          //   duration: 1000,
          //   icon: 'none',
          //   success: () => {
          //     setTimeout(() => {
          //       wx.navigateTo({
          //         url: '/packageB/member/category/search_v2/search_v2?tag=cultivate_course&course_term_id=' + this.options.id,
          //       })
          //     }, 1000);
          //   }
          // })
        }
      },
      fail: function (res) {
        console.log(res);
      },
    });
  },
  CourseListMore(e) {
    console.log(e);
    let {key} = e.currentTarget.dataset;
    let urlStr = "";
    let json = {};
    if (key == 'changing') {
      urlStr = app.getNetAddresss("plugin.cultivate-course.frontend.controllers.course.replace.get-course-list");
      json = {
        member_id: this.data.changeJson.member_id,
        course_term_id: this.data.checkboxArr[0],
        page: this.data.course_list.current_page + 1
      }
    } else if (key == 'apply') {
      urlStr = app.getNetAddresss("plugin.cultivate-course.frontend.controllers.member.wait-quota.get-course-list");
      json = {
        goods_id: this.data.checkboxArr[0],
        page: this.data.course_list.current_page + 1,
        member_id: this.data.applyJson.member_id,
        check_quota:1
      }
    }
    app._postNetWork({
      url: app.getNetAddresss(urlStr),
      data: json,
      success: (resdata) => {
        var res = resdata.data;
        if (res.result == 1) {
          this.data.course_list.data = this.data.course_list.data.concat(res.data.course_list.data)
          this.data.course_list.current_page = res.data.course_list.current_page;
          this.setData({
            'course_list.data': this.data.course_list.data,
            'course_list.current_page': this.data.course_list.current_page
          })
        } else {
          app.tips(res.msg);
        }
      }
    });
  },
  // 获取课期
  getCourseList(key = '') {
    let urlStr;
    let json = {};
    if (key == 'changing') {
      urlStr = app.getNetAddresss("plugin.cultivate-course.frontend.controllers.course.replace.get-course-list");
      json = {
        member_id: this.data.changeJson.member_id,
        course_term_id: this.data.checkboxArr[0],
      }
    } else if (key == 'apply') {
      urlStr = app.getNetAddresss("plugin.cultivate-course.frontend.controllers.member.wait-quota.get-course-list");
      json = {
        goods_id: this.data.checkboxArr[0],
        member_id: this.data.applyJson.member_id,
        check_quota:1
      }
    }
    app._postNetWork({
      url: urlStr,
      data: json,
      success: (resdata) => {
        var res = resdata.data;
        if (res.result == 1) {
          this.setData({
            course_list: res.data.course_list
          })
          if (key == 'changing') {
            this.setData({
              changingShow: true
            })
          } else if (key == 'apply') {
            this.setData({
              courseShow: true
            })
          }
        } else {
          app.tips(res.msg)
        }
      },
      fail: function (res) {
        console.log(res);
      },
    });
  },
  // 核销报名
  clerkPost(uid) {
    let urlStr = app.getNetAddresss("plugin.cultivate-course.frontend.controllers.course.replace.clerk");
    app._postNetWork({
      url: urlStr,
      data: {
        id: this.data.checkboxArr[0],
        member_id: uid
      },
      success: (resdata) => {
        var res = resdata.data;
        if (res.result == 1) {
          app.tips(res.msg)
        } else {
          app.tips(res.msg)
        }
      },
      fail: function (res) {
        console.log(res);
      },
    });
  },
  // 复选框方法
  onChange_CheckBox(e) {
    // let arr = e.detail;
    // console.log(arr)
  },
  // 步进器方法
  onChange(e) {
    this.setData({
      "donateJson.count": e.detail
    })
  },
  // 复选框方法
  tap_checkBox(e) {
    let {
      id,
      item
    } = e.currentTarget.dataset;
    if (!item.can_operate) return
    if (this.data.checkboxArr.indexOf(String(id)) != '-1') {
      this.setData({
        checkboxArr: []
      })
      return
    }
    this.setData({
      checkboxArr: [String(id)]
    })
  },
  donatInputComfirm_more() {
    this.donatInputComfirm('more')
  },
  // 选择转赠人员
  setReceiveMid(e) {
    console.log(e)
    let {
      uid
    } = e.currentTarget.dataset.item
    this.setData({
      'donateJson.receive_member_id': uid,
      'donateJson.rm': e.currentTarget.dataset.item
    })
  },
  // 搜索转赠人员
  donatInputComfirm(key = '') {
    let json = {
      keyword: this.data.inpDonate
    }
    if (key == 'more') {
      if (this.data.donateUserList.current_page >= this.data.donateUserList.last_page) {
        return
      }
      this.setData({
        'donateUserList.current_page': this.data.donateUserList.current_page + 1
      })
      json.page = this.data.donateUserList.current_page;
    }
    let urlStr = app.getNetAddresss("plugin.cultivate-course.frontend.controllers.course.replace.get-member");
    app._postNetWork({
      url: urlStr,
      data: json,
      success: (resdata) => {
        var res = resdata.data;
        if (res.result == 1) {
          if (key == 'more') {
            this.setData({
              'donateUserList.data': this.data.donateUserList.data.concat(res.data.data),
            })
            return
          }
          this.setData({
            donateUserList: res.data
          })
        } else {
          app.tips(res.msg)
        }
      },
      fail: function (res) {
        console.log(res);
      },
    });
  },
  closePopup_donate() {
    this.data.donateJson = {
      goods_id: '',
      course_type: '',
      count: 1,
      receive_member_id: '',
      member_id: '',
    }
    this.setData({
      donateJson: this.data.donateJson,
      donateShow: false
    })
  },
  donateComfirm() {
    if (app._isTextEmpty(this.data.donateJson.receive_member_id)) {
      app.tips('请选择转入会员')
      return
    }
    if (app._isTextEmpty(this.data.donateJson.receive_member_id)) {
      app.tips('请选择转入会员')
      return
    }
    let urlStr = app.getNetAddresss("plugin.cultivate-course.frontend.controllers.course.replace.transfer");
    let json = {
      ...this.data.donateJson
    };
    delete (json.rm);
    app._postNetWork({
      url: urlStr,
      data: json,
      success: (resdata) => {
        var res = resdata.data;
        if (res.result == 1) {
          app.tips(res.msg)
          delete (this.data.donateJson.rm)
          this.data.donateJson.count = 1;
          this.setData({
            donateShow: false,
            donateJson: this.data.donateJson,
            donateUserList: [],
            inpDonate: ''
          })
        } else {
          app.tips(res.msg)
        }
      },
      fail: function (res) {
        console.log(res);
      },
    });
  },
  changing_onClose() {
    this.setData({
      changingShow: false,
    })
  },
  changing_Comfirm() {
    console.log(this.data.changeJson)
    let urlStr = app.getNetAddresss("plugin.cultivate-course.frontend.controllers.course.replace.change");
    app._postNetWork({
      url: urlStr,
      data: this.data.changeJson,
      success: (resdata) => {
        var res = resdata.data;
        if (res.result == 1) {
          app.tips(res.msg);
          this.setData({
            listData:[]
          })
          this.changing_onClose();
          setTimeout(() => {
            this.getCateData();
          }, 500);
        } else {
          app.tips(res.msg)
        }
      },
      fail: function (res) {
        console.log(res);
      },
    });
  },
  getDonateCourse_type() {
    let urlStr = app.getNetAddresss("plugin.cultivate-course.frontend.controllers.course.replace.get-quota-list");
    app._postNetWork({
      url: urlStr,
      data: {
        goods_id: this.data.checkboxArr[0],
        member_id: this.data.donateJson.member_id
      },
      success: (resdata) => {
        var res = resdata.data;
        if (res.result == 1) {
          console.log(res.data.data)
          if (res.data.data.length == 1) {
            // 当前课程只有一种类型不用选择直接到转赠弹窗
            this.setData({
              donateShow: true,
              'donateJson.course_type': res.data.data[0].course_type,
              'donateJson.receive_member_id': ''
            })
          } else {
            this.setData({
              donateCourseType_show: true,
              donateCourseType_list: res.data,
              'donateJson.course_type': res.data.data[0].course_type
            })
            // console.log(this.data.donateCourseType_list, 'donateCourseType_list')
          }
        } else {
          app.tips(res.msg)
        }
      },
      fail: function (res) {
        console.log(res);
      },
    });
  },
  // 关闭查询课程类型弹窗
  close_donateCourseType_show() {
    this.setData({
      donateCourseType_show: false,
      donateCourseType_list: []
    })
  },
  Comfirm_donateCourseType_show() {
    if (this.data.donateJson.course_type == '0' || this.data.donateJson.course_type == '1' || this.data.donateJson.course_type == '2') {
      this.setData({
        donateCourseType_show: false,
        donateShow: true,
        'donateJson.receive_member_id': ''
      })
    }
  },
  radioChange(e) {
    this.setData({
      "donateJson.course_type": e.detail.value
    })
  },
  radioTap(e) {
    this.setData({
      "donateJson.course_type": e.currentTarget.dataset.item.course_type
    })
  },
  getStatistics_more() {
    this.getStatistics('more')
  },
  getStatistics(key = '') {
    let json = {
      date: (this.data.SelectTime / 1000)
    }
    if (key == 'more') {
      if (this.data.statistics_list.current_page >= this.data.statistics_list.last_page) {
        return
      }
      this.setData({
        'statistics_list.current_page': this.data.statistics_list.current_page + 1
      })
      json.page = this.data.statistics_list.current_page;
    }
    let urlStr = app.getNetAddresss("plugin.cultivate-course.frontend.controllers.course.clerk.get-statistics");
    app._postNetWork({
      url: urlStr,
      data: json,
      success: (resdata) => {
        var res = resdata.data;
        if (res.result == 1) {
          if (key == 'more') {
            this.setData({
              'statistics_list.data': this.data.statistics_list.data.concat(res.data.course_statistics.data),
            })
            return
          }
          this.setData({
            statisticsCount: res.data.count,
            statistics_list: res.data.course_statistics
          })
        } else {
          app.tips(res.msg)
        }
      },
      fail: function (res) {
        console.log(res);
      },
    });
  },
  close_timeSetShow() {
    this.setData({
      timeSetShow: false,
    })
  },
  dateTimeConfirm(e) {
    console.log(e.detail)
    this.setData({
      timeSetShow: false,
      currentDate: e.detail,
      SelectTime: e.detail
    })
    this.getStatistics();
    this.getCateData();
  },
  tapTimeSetShow() {
    this.setData({
      timeSetShow: true
    })
  },
  clearnTime() {
    this.setData({
      SelectTime: ''
    })
    this.getStatistics();
    this.getCateData();
  },
  hideTap() {
    this.setData({
      statisticsHide: false
    })
  }
})